package com.atguigu.gmall.product.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;

@Controller
@RequestMapping("/hello")
public class HelloController {
    //进入页面
    @GetMapping("/h")
    public String h(Model model, HttpSession httpSession){
        model.addAttribute("hello","世界!你好!");
        ArrayList<String> list = new ArrayList<>();
        list.add("小菊");
        list.add("王宁");
        list.add("有恒");
        list.add("王萍");
        model.addAttribute("list",list);
        model.addAttribute("num",10);
        httpSession.setAttribute("ses","我是session值");
        return "hello";
    }
}
